/**
 * @param {number[]} nums
 * @return {number}
 */
var jump = function (nums) {
    if (nums.length === 1) return 0
    let maxJumpRight = nums[0] + 0, i = 0, right = 0, count = 1;
    while (maxJumpRight < nums.length - 1) {
        right = maxJumpRight
        for (; i <= right; i++) {
            maxJumpRight = Math.max(maxJumpRight, nums[i] + i)
        }
        count++
    }
    return count
};